package zero.tech.wsnet.node;

import org.springframework.context.annotation.Import;

import zero.tech.wsnet.node.service.NodeServiceImpl;

@Import(value = {NodeServiceImpl.class})
public class NodeMonitor {
	public static void createNodeClient(String ip, int port, String playerId, boolean autoReconect) {
		try {
			final NodeClient myClient = new NodeClient(ip, port, playerId, autoReconect);
			new Thread(new Runnable() {
				
				@Override
				public void run() {
					boolean ok = false;
					while (!ok) {
						try {
							Thread.sleep(3000);
						} catch (InterruptedException e) {
							e.printStackTrace();
						}
						ok = myClient.connect();
						System.out.println("---------------------连接状态:"+ok);
					}
				}
			}).start();
			//ws://192.168.3.64:5000/discovery/engine/game-engine-rummy00
			//ws://192.168.3.64:5000/discovery/engine/game-engine-gate00
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
